package com.bs.sc.front.goodsCar.dao;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.bs.sc.front.goodsCar.entity.GoodsCarItem;

@Repository("goodsCarItemDao")
public interface GoodsCarItemDao extends JpaRepository<GoodsCarItem, String> {

	@Modifying
	@Query(value = "DELETE FROM goods_car_item WHERE goods_car_id IN ?1", nativeQuery = true)
	public void deleteByGoodsCarId(String[] goodsCarIds);

	@Query(value = "SELECT a.user_id as userId,b.goods_id as goodsId,b.grade as grade FROM confirm_order a,confirm_order_item b where a.id = b.order_id", nativeQuery = true)
	public List<Map<String, Object>> findAllBuyGoods();
}
